package com.foreknow.elm.service.impl;

import com.foreknow.elm.dao.FoodDao;
import com.foreknow.elm.dao.impl.FoodDaoImpl;
import com.foreknow.elm.po.Food;
import com.foreknow.elm.service.FoodService;
import com.foreknow.elm.util.DBUtil;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author shkstart
 * @create 2021-08-26 16:21
 */
public class FoodServiceImpl  implements FoodService {
    /**
     * 根据商家编号查询所属食品信息
     * @param businessId
     * @return
     */
    @Override
    public List<Food> listFoodByBusinessId(int businessId) {
        List<Food> foods=new ArrayList<Food>();
        FoodDao dao=new FoodDaoImpl();
        try {
            foods = dao.listFoodByBusinessId(businessId);
            return  foods;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        finally {
            DBUtil.close();
        }
        return null;
    }
}
